package com.jack.controller;

import java.util.Map;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import com.google.common.collect.Maps;
import com.jack.entity.User;
import com.jack.service.UserFeignClient;
import com.netflix.governator.annotations.binding.Request;

@RestController
public class UserMovieController {

	@Autowired
	private UserFeignClient userFeignClient;
	
	@GetMapping("/user/{id}")
	public User findOne(@PathVariable Long id){
		User user =userFeignClient.findById(id);
		return user;
	}
	
	
	//TODO not success
	@PostMapping("/user/post")
	public User post( User user){
		User user2 =userFeignClient.post(user);
		return user2;
	}
	
	
	@GetMapping("/user/user/get1")
	public User get1( Long id,  String name){
		User user =userFeignClient.get1(id, name);
		return user;
	}
	
//	@GetMapping("/user/user/get2")
//	public User get2( String username,  String name){
//		Map<String, Object> map = Maps.newHashMap();
//		map.put(username, "account1");
//		map.put(name, "zhansan");
//		User user =userFeignClient.get2(map);
//		return user;
//	}
	
	
}
